Click HTML except one element [ WITHOUT JQuery ]

Posted by Tomirammstein on Stack Overflow See other posts from Stack Overflow or by Tomirammstein
Published on 2012-04-06T23:19:37Z Indexed on 2012/04/06 23:30 UTC
Read the original article Hit count: 330

Filed under:
|
|
|

I show us the code:

(function (){
  var element = document.getElementById('bar'), hideElement = document.getElementById('foo'),
  var html = document.getElementsByTagName('html')[0];
  tool.onclick = function() {
    hideElement.style.display = 'block';
    html.onclick = function() {
      hideElement.style.display = 'none';
    }
  }
})();

This piece of code work's fine, but, after clicking html, I can not reopen the hidden element.

I want to click the html element and give display:none to hideElement, then to click the element id="bar", give to the hidden element display:block, but instead of click the element foo, click the html element. What I can do?

Oh, i need help WITHOUT JQUERY, thanks :)

EDIT: something like that : click on body except some other tag not working , but without JQuery,

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about html